<template>
  <div class="editWidthHeightPopup">
      <div class="editWidthHeightPopup-content"
        :style="{width: width}">
        <div class="editWidthHeightPopup-content-header">
            <span>{{title}}</span>
            <i class="fa fa-close" @click="handleClose"></i>
        </div>
        <div class="content-slot">
            <slot></slot>
        </div>
        <div class="editWidthHeightPopup-content-footer">
            <div class="mt-button mtdefault" @click.prevent.stop="handleClose">取消</div>
            <div class="mt-button mtprimary" @click.prevent.stop="handleConfirm">确定</div>
        </div>
      </div>
    </div>
</template>

<script>
export default {
    props: {
        width: {
            type: String,
            default: '30%'
        },
        title: {
            type: String,
            default: '提示'
        }
    },
    methods: {
        handleClose() {
            this.$emit('close')
        },
        handleConfirm() {
            this.$emit('confirm')
        } 
    }
}
</script>

<style scoped>
.editWidthHeightPopup {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}
.editWidthHeightPopup-content {
  min-height: 300px;
  background-color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.editWidthHeightPopup-content-header {
    height: 30px;
    background: rgba(230, 229, 229,0.5);
    color: gray;
    display: flex;
    justify-content: space-between;
    padding: 5px;
    box-sizing: border-box;
}
.editWidthHeightPopup-content-footer {
    height: 50px;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-end;
}
.content-slot {
    flex-grow: 1;
}
.mt-button {
    font-size: 14px;
    width: 60px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    
}
.mtdefault {
    background-color: lightgray;
    color: black;
}
.mtprimary {
    background-color: rgb(26, 120, 243);
    margin-left: 10px;
    color: white;
}
</style>